package ytdp.careagle.com.ytdp.entity;

import android.text.TextUtils;

import com.google.gson.Gson;
import com.mcxtzhang.indexlib.suspension.ISuspensionInterface;

import java.util.List;

/**
 * Created by lida on 2017/7/31 0031.
 */

public class SeriesRelationship {

    /**
     * subBrandName : 一汽-大众
     * children : [{"body":"6","bodyName":"三厢车","brandName":"大众","capitalType":"2","capitalTypeName":"合资车","code":"series-135","hide":0,"id":"ffe67ef1bba945668abebcdb23f29d25","image":"http://img.souche.com/files/carproduct/series/series-135.png","level":"midSize","levelName":"中型车","name":"迈腾","outputVolumeEnum":"2.0T,1.4T,1.8T,3.0L,2.0L","parent":"brand-41","pinyin":"maiteng","priceRange":"206022-363415","subBrandName":"一汽-大众"},{"body":"5","bodyName":"两厢车","brandName":"大众","capitalType":"2","capitalTypeName":"合资车","code":"series-266","hide":0,"id":"b59922c513c74970b49a5ed45cd82b90","image":"http://img.souche.com/files/carproduct/series/series-266.png","level":"compactCar","levelName":"紧凑型车","name":"高尔夫","outputVolumeEnum":"2.0T,1.4T,1.6L,1.8L,1.2T","parent":"brand-41","pinyin":"gaoerfu","priceRange":"125914-255953","subBrandName":"一汽-大众"}]
     */

    private String subBrandName;
    private List<ChildrenBean> children;

    public static SeriesRelationship objectFromData(String str) {

        return new Gson().fromJson(str, SeriesRelationship.class);
    }

    public String getSubBrandName() {
        return subBrandName;
    }

    public void setSubBrandName(String subBrandName) {
        this.subBrandName = subBrandName;
    }

    public List<ChildrenBean> getChildren() {
        return children;
    }

    public void setChildren(List<ChildrenBean> children) {
        this.children = children;
    }

    public static class ChildrenBean implements ISuspensionInterface {
        /**
         * body : 6
         * bodyName : 三厢车
         * brandName : 大众
         * capitalType : 2
         * capitalTypeName : 合资车
         * code : series-135
         * hide : 0
         * id : ffe67ef1bba945668abebcdb23f29d25
         * image : http://img.souche.com/files/carproduct/series/series-135.png
         * level : midSize
         * levelName : 中型车
         * name : 迈腾
         * outputVolumeEnum : 2.0T,1.4T,1.8T,3.0L,2.0L
         * parent : brand-41
         * pinyin : maiteng
         * priceRange : 206022-363415
         * subBrandName : 一汽-大众
         */
        private String name;
        private String subBrandName;
        private String image;
        private String bodyName;
        private String code;

        public static ChildrenBean objectFromData(String str) {

            return new Gson().fromJson(str, ChildrenBean.class);
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getBodyName() {
            return bodyName;
        }

        public void setBodyName(String bodyName) {
            this.bodyName = bodyName;
        }

        public String getImage() {
            return image;
        }

        public void setImage(String image) {
            this.image = image;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getSubBrandName() {
            return subBrandName;
        }

        public void setSubBrandName(String subBrandName) {
            this.subBrandName = subBrandName;
        }

        @Override
        public boolean isShowSuspension() {
            return true;
        }

        @Override
        public String getSuspensionTag() {
            if (TextUtils.isEmpty(subBrandName)) {
                return "暂无";
            }
            return subBrandName;
        }
    }
}
